package com.kangye.learnstudent.service.impl;

import com.kangye.learnstudent.entity.Grade;
import com.kangye.learnstudent.mapper.GradeMapper;
import com.kangye.learnstudent.service.GradeService;
import com.kangye.learnstudent.util.ViewJsonObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: learndeduo
 * @description: 实现年级逻辑接口
 * @author: 索腾龙
 * @create: 2021-05-17 11:01
 **/
@Service
@Transactional
public class GradeServiceImpl implements GradeService {
    @Autowired
    private GradeMapper gradeMapper;

    /**
     * 获取全部年级
     * @return
     */
    @Override
    public ViewJsonObject<Grade> getGradeAll() {
        //调用数据层获取数据
        List<Grade> gradeAll = gradeMapper.getGradeAll();
        return new ViewJsonObject<>(gradeAll);
    }
}